Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

335
Views
"paths" in `tsconfig` not picking up declarations from node_modules with module import pointing to parent directory

While putting a package together I need modules to point to the location of certain dependencies (/web_modules) located in my project root.

However typescript is unable to find the declaration files that come with the 3rd party modules (litElement) if I specify the pat like (../ for parent): '../web_modules/lit-element.js'.

structure:

  |--- src
      |--- report-editor.ts
  |--- web_modules
      |--- lit-element.js

Import:

import { LitElement, html, property, css, query } from '../web_modules/lit-element.js';

Could not find a declaration file for module '../web_modules/lit-element.js'. '/Users/foo/Components/report_editor/web_modules/lit-element.js' implicitly has an 'any' type.

To fix the issue I've tried to re-map the location to the proper declaration files via:

"paths": {
  "../web_modules/*.js": [
     "node_modules/@types/*",
     "node_modules/*",
     "web_modules/*.js"
   ]
 }

But it still gives the same error (tried restarting the editor, no luck either). The only way to stop the error is using a path like (/ for root): '/web_modules/lit-element.js' both for the import and the mapping, but this way when I install the package in the target project it tries looking for the dependencies in the project root instead the package's root foler :(

How to rewrite the "paths" mapping for typescript to accept the format: '../web_modules/lit-element.js'??

Thanks!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!